package com.mhc.suzuki.manager.impl;

import com.mhc.suzuki.dal.mapper.ext.TowingHisExtMapper;
import com.mhc.suzuki.dal.model.TowingHisDO;
import com.mhc.suzuki.dal.query.TowingHisQuery;
import com.mhc.suzuki.manager.TowingHisManager;
import com.subaru.common.query.PageResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;


/**
 * Manager for TowingHis.
 */

@Component
public class TowingHisManagerImpl implements TowingHisManager {


    @Autowired
    protected TowingHisExtMapper towingHisExtMapper;

    /**
     * query count by query condition.
     */
    @Override
    public int countByQuery(TowingHisQuery query) {
        return towingHisExtMapper.countByQuery(query);
    }

    /**
     * delete by query condition.
     */
    @Override
    public int deleteByQuery(TowingHisQuery query) {
        return towingHisExtMapper.deleteByQuery(query);
    }

    /**
     * delete by primary key.
     */
    @Override
    public int deleteByPrimaryKey(TowingHisDO record) {
        return towingHisExtMapper.deleteByPrimaryKey(record);
    }

    /**
     * insert selective.
     */
    @Override
    public long insertSelective(TowingHisDO record) {
        return towingHisExtMapper.insertSelective(record);
    }

    /**
     * select by query condition.
     */
    @Override
    public List<TowingHisDO> selectByQuery(TowingHisQuery query) {
        return towingHisExtMapper.selectByQuery(query);
    }

    /**
     * select by query condition with page.
     */
    @Override
    public PageResult<TowingHisDO> selectByQueryWithPage(TowingHisQuery query) {
        PageResult<TowingHisDO> result = new PageResult<TowingHisDO>();
        result.setPageSize(query.getPageSize());
        result.setPageNo(query.getPageNo());
        result.setTotalCount(this.countByQuery(query));
        result.setResult(this.selectByQuery(query));
        return result;
    }

    /**
     * select by primary key.
     */
    @Override
    public TowingHisDO selectByPrimaryKey(Long id) {
        return towingHisExtMapper.selectByPrimaryKey(id);
    }

    /**
     * update by query condition selective.
     */
    @Override
    public int updateByQuerySelective(TowingHisDO record, TowingHisQuery query) {
        return towingHisExtMapper.updateByQuerySelective(record, query);
    }

    /**
     * update by query condition.
     */
    @Override
    public int updateByQuery(TowingHisDO record, TowingHisQuery query) {

        return towingHisExtMapper.updateByQuery(record, query);
    }

    /**
     * update by primary key selective.
     */
    @Override
    public int updateByPrimaryKeySelective(TowingHisDO record) {
        return towingHisExtMapper.updateByPrimaryKeySelective(record);
    }
}